package com.oren.system.mapper;

import com.oren.system.pojo.Department;

import java.util.List;

/**
 * @Author: wsw
 * @Description:
 * @Date: Create on 2018/7/29 14:51
 */
public interface DepartmentMapper {

    /**
     * 查询根节点的部门id
     * @return
     * @throws Exception
     */
    Department findDeParent()throws Exception;

    /**
     * 根据父id查询子信息
     * @param parment
     * @return
     * @throws Exception
     */
    List<Department> findDeChild(Integer parment)throws Exception;

    /**
     * 删除信息
     * @param id
     * @throws Exception
     */
    int deleteDepartment(Integer id)throws Exception;

    /**
     * 添加部门
     * @param department
     * @return
     * @throws Exception
     */
    int insertDepartment(Department department)throws Exception;

    /**
     * 修改信息
     * @param department
     * @return
     * @throws Exception
     */
    int updateDepartment(Department department)throws Exception;

    /**
     * 根据userId查询部门
     * @param userId
     * @return
     */
    Department findDepartmentByUserId(Integer userId);

    /**
     * 根据部门查询上级部门
     * @param praentId
     * @return
     */
    Department findLeader(Integer praentId);
}
